package com.itheima.consumer.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {

    @Bean
    public FanoutExchange fanoutExchange() {
        return new FanoutExchange("hmall.fanout2");
    }

    @Bean
    public Queue fanoutQueue3() {
        return new Queue("fanout.queue3");
    }

    @Bean
    public Binding fanoutBinding3(Queue fanoutQueue3, FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(fanoutQueue3).to(fanoutExchange);
    }


    @Bean
    public DirectExchange directExchange() {
        return new DirectExchange("hmall.fanout2",  true, false);
    }

    @Bean
    public Queue directQueue3() {
        return new Queue("fanout.queue3",  true);
    }

    @Bean
    public Binding directBinding3() {
        return BindingBuilder.bind(directQueue3()).to(directExchange()).with("ss");
    }
}
